#region Copyright Jonathan Quiros

//	
// All rights are reserved. Reproduction or transmission in whole or in 
// part, in any form or by any means, electronic, mechanical or otherwise, 
// is prohibited without the prior written consent of the copyright owner.
//
// Filename: RolesRepository.cs
//

#endregion

using System;
using System.Linq;
using System.Collections.Generic;
using Novagoal.Models;

namespace Novagoal.Repositories.Entities
{
    public class RolesRepository : BaseRepository, IRolesRepository
    {
        #region CONSTANTS



        #endregion

        #region PROPERTIES

        

        #endregion

        #region PUBLIC METHODS

        public List<Role> GetRoles(int maxRoleId)
        {
            return EntitiesContext.roles
                .Where(r => r.id <= maxRoleId)
                .Select(r => new Role
                                 {
                                     Id = r.id,
                                     Name = r.name,
                                     CreatedAt = r.created_at,
                                     UpdatedAt = r.updated_at,
                                     UpdatedBy = r.updated_by
                                 })
                .OrderBy(r => r.Name)
                .ToList();
        }

        #endregion

        #region PRIVATE METHODS



        #endregion
    }
}